Skip to content

Add option to display commit author identity with git config source#112

Merged
pol-rivero merged 4 commits into
pol-rivero:mainfrom
voiduin:feature/show-commit-author-config-origin
Mar 31, 2026
Merged

Add option to display commit author identity with git config source#112
pol-rivero merged 4 commits into
pol-rivero:mainfrom
voiduin:feature/show-commit-author-config-origin

Conversation

@voiduin

@voiduin voiduin commented Mar 29, 2026

Copy link
Copy Markdown

I was about to leave GitHub Desktop because it doesn't support multiple accounts — but then I found this fork, and it's exactly what I needed. Thank you for maintaining it!

Problem source

However, one thing was missing for my workflow: I work with two different GitHub accounts (personal and work), and I use includeIf in my git config to automatically switch user.name and user.email depending on the project directory. Several times I accidentally pushed commits to personal projects under my work identity — simply because there was no visible indication of which credentials would be used.

The avatar alone isn't always enough to tell accounts apart - not everyone has a distinct avatar set up, and the name/email are what actually end up in the commit. And if such a commit makes it into the repository, removing the committer from the contributors list on the main page is practically impossible — the only way is to delete the repository entirely.

My setup example

I don't set user.name/user.email in my global ~/.gitconfig at all. Instead, I use includeIf to load different identities based on the project directory:

# File ~/.gitconfig without global name and email

[includeIf "gitdir:D:/Work/personal/"]
    path = D:/Work/personal/.gitconfig_personal

[includeIf "gitdir:F:/Work/company/"]
    path = F:/Work/company/.gitconfig_work

Each included file sets its own user.name and user.email. Without this feature, there was no way to tell which identity GitHub Desktop would use for the next commit.

Description

This PR displays the resolved user.name and user.email above the commit summary field, along with tooltips indicating which git config file each value comes from (global, includeIf, local). The feature is controlled by a toggle in Preferences > Git > Author and is disabled by default.

This PR adds an optional setting (Preferences > Git > Author > "Show effective identity and config scope above commit message") that:

  1. Moves the avatar above the summary field and displays the resolved user.name and user.email next to it
  2. Shows an interactive tooltip on hover with the scope and file path of each value, distinguishing between:
  • global (standard ~/.gitconfig)
  • global, via [includeIf] (conditionally included file)
  • and local (.git/config)

The setting is disabled by default, so existing users won't notice any changes unless they opt in. I tried to keep the diff minimal and follow the existing code patterns.

Screenshots

Before change - avatar inline with title, without name and email
image

Added setting in Preferences -> Git -> Author (disabled by default):
image

After enabling — avatar, name, and email are always visible above the summary:
image

Scopes

1. Simple global

Hovering over the details reveals the exact config file. This is how a simple global config is detected:
image

2. includeIf

Notice how it correctly resolves and displays conditional global configs applied via includeIf.
image

3. Local

Example with local repository overrides: the tooltip accurately reflects when the credentials are being pulled from the local .git/config file instead of the global settings.
image

4. System

image

Repo config

Repository settings also show the resolved identity with clickable file paths - useful when an includeIf directive applies, since the form fields may not reflect the actual effective values.
image

Release notes

Notes: Adds optional display of commit author name, email, and their git config source above the summary field (Preferences -> Git -> Author).

voiduin added 2 commits March 29, 2026 18:46
Show the resolved user.name and user.email above the commit summary field along with tooltips indicating which git config file each value comes from (global, includeIf, local).
The feature is controlled by a toggle in Preferences > Appearance and is disabled by default.
@voiduin

voiduin commented Mar 30, 2026

Copy link
Copy Markdown
Author

Fix lint errors and improve commit author info UI

  1. Fix linter errors from CI/CD
  2. Replace title attribute with native tooltip component

Old tooltip

image

New tooltip

image

  1. Improve config origin display style

Old config view
image

New config view
image

@pol-rivero

Copy link
Copy Markdown
Owner

This looks like a nice addition :)
I have 2 small change requests:

  1. Since the "Appearance" settings are already too crowded and we have an almost-empty settings page just for the commit author, let's move this checkbox there
image
  1. The "Resolved effective identity" section currently looks grayed out, which can be confusing because across the app "grayed out" means "disabled" so it seems as if the identity would be somehow disabled.
image

The fix is to simply remove the color directive in the .git-config-origin-hint CSS:

image

@voiduin

voiduin commented Mar 30, 2026

Copy link
Copy Markdown
Author

All done!)

Here's the applied changes based on your feedback. Some implementation details came up along the way, but I made sure the default behavior remains unchanged for existing users.

Detailed breakdown:

1. Moved the checkbox to Preferences -> Git -> Author tab

1.1. Move "show identity"

Moved the "show identity" checkbox from Appearance to the Git tab as requested.

1.2. Global config tab save problem

While working on this, I discovered a side effect: clicking Save on the Git tab would write user.name and user.email to the global config even if they weren't set there originally. This is a problem for users who rely on includeIf directives - the global values would override the conditionally included identity.

To address this, I added a "Store author identity in global Git config" checkbox that reflects the current state of the global config:

  • If global config already has user.name/user.email -> checkbox is checked, fields are editable
  • If global config has no identity -> checkbox is unchecked, fields are disabled, nothing is written on Save
  • If the user unchecks it -> user.name and user.email are removed from the global config on Save (necessary for includeIf to work correctly without being overridden). Plus - a warning is shown before saving to confirm the removal

1.3. Link to info

Added a link to the https://git-scm.com/docs/git-config#SCOPES below the display checkbox, since this tab was previously only about global settings and the scope concept may not be obvious to all users.

1.4. Add headers

Added section headings ("Global Author" / "Commit Identity Display") to the Author tab - without them the two unrelated settings appeared visually connected.

  • Before (no headings) - not clear:
image
  • After (with headings) - more usable:
image
  • Warning when unset check box about remove creditanse section from global config (one style with standart warning when entered wrong email on this tab)
image

2. Repository settings - Git Config page

2.1) Changed the "Resolved effective identity" text from secondary (muted) color to default, so it no longer looks disabled.
2.2) Made file paths clickable - clicking reveals the config file in the system file manager.

  • Old before change - gray
image
  • After change - white
image

3. Tooltip

3.1) Renamed 'Source' label to 'Scope' in tooltips to match official Git terminology
3.2) Clickable path to file in tooltip

  • Old before change
image
  • After change
image

@pol-rivero

Copy link
Copy Markdown
Owner

Everything looks good, thank you! :)

@pol-rivero pol-rivero merged commit 90f899b into pol-rivero:main Mar 31, 2026
18 checks passed
@pol-rivero

Copy link
Copy Markdown
Owner

This is now available in v3.5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants